<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<script type="text/javascript" src="${sbase}scripts/jquery-ui-multiselect/js/jquery.multiselect.js"></script>
<script type="text/javascript" src="${sbase}scripts/jquery-ui-multiselect/js/jquery.multiselect.filter.js"></script>
<link href="${sbase}scripts/jquery-ui-multiselect/css/jquery.multiselect.css" rel="stylesheet" scope="all"/>
<link href="css/apps/workflow/process/get.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript">
 var stepSize = ${fn:length(bean.workflowDescriptor.steps)}||0;
 var workflowName = '${bean.workflowName}'||'';
 var sets = new Array();
</script>
 <form>

<table class="processTable">
<caption>工作流程[${bean.workflowName}]人员选择器设置程序</caption>
<thead>
<tr>
<td colspan="7">如果设置了用户,工作流流转过程中用户优先被使用,人员选择器其次被考虑</td>
</tr>
<tr>
<th>活动名称</th>
<th colspan="6">选择器列表</th>
</tr>
</thead>
<tbody>
<c:forEach var="step" items="${bean.workflowDescriptor.steps}" varStatus="vs">
  <script type="text/javascript">
     sets[${step.id}]= new Array();
  </script>
  

<tr class="stepName">
 <td colspan="7">[${step.id}]-${step.name}</td>
</tr>
<c:forEach items="${step.actions}" var="act">
<script type="text/javascript">
        sets[${step.id}][${act.id}]={
		    "id":{
		    	"actionId":${act.id},
		    	"stepId":${step.id}
		    	//"workflowName":workflowName
		    	
		    },
			"user":null,
			"departments":[],
			"roles":[]
		};
       
  </script>

<tr>
  <td>[${step.id}-${act.id}] ${act.name}</td>
  <td>
  <label>
    <input type="radio" name="beans[${step.id*act.id}].owner.username" value="starter_userid" onclick="setStepOwner(${step.id},${act.id},this.value)"/>
                 拟稿人
    </label> 
   
  
  </td>
  
  <td>
   <label>
    <input type="radio" name="beans[${step.id*act.id}].owner.username" value="last_executor_userid" onclick="setStepOwner(${step.id},${act.id},this.value)"/>
                发送人
    </label> 
  </td>
  
  <td>
    
    <label>    
    <input id="specOwner${step.id*act.id}" type="radio" value="finisher_userid" name="beans[${step.id*act.id}].owner.username" />
              指定办理人[默认为归档人]
    </label> 
    <select onchange="setVarName(${step.id},${act.id},this)">
      <optgroup label="请选择变量">
      <c:forEach items="${varSettings}" var="item">
         <option value="${item.name}">${item.label}[${item.value}]</option>
      </c:forEach>
      </optgroup>
    </select>
  </td>
  
  <td>
   <label>
    <input type="radio" name="beans[${step.id*act.id}].owner.username" onclick="openDeptSelector(${step.id},${act.id});"/>
              部门选择器
    </label> 
  
  </td>
  
  <td>
  <label>
    <input type="radio" name="beans[${step.id*act.id}].owner.username" onclick="openRoleSelector(${step.id},${act.id});"/>
               角色选择器
    </label> 
    
  </td>
  
  <td>
   
   <label>
    <input type="radio" name="beans[${step.id*act.id}].owner.username" onclick="setDeptSelector(${step.id},${act.id});"/>
              默认选择器
    </label> 
  </td>
</tr>
</c:forEach>
</c:forEach>
</tbody>
</table>



<div id="deptSelector">
<select id="depts" multiple="multiple" size="5">
  <option value='root'>
  <span style="color:red;font-weight:bolder">   
     全部人员选择器
  </span>   
     </option>
</select>
</div>
<div id="roleSelector">
<select id="roles" multiple="multiple" size="5">
  <option value='root'>
  <span style="color:red;font-weight:bolder">   
     全部人员选择器
  </span>   
     </option>
</select>
</div>
<button id="saveBtn" type="button">保存设置</button>
<button type="reset">重置</button>
</form>

<script type="text/javascript" src="scripts/apps/workflow/process/get.js"></script>